package com.springmvc.web.dao.impl;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


import com.springmvc.web.dao.ILoginDao;
import com.springmvc.web.entity.LoginForm;
import com.springmvc.web.mapper.LoginFormMapper;

@Repository
public class LoginDaoImpl extends SqlSessionTemplate implements ILoginDao {
	
	
    private LoginFormMapper loginFormMapper;
		
    @Autowired
	public LoginDaoImpl(SqlSessionFactory sqlSessionFactory) {
		super(sqlSessionFactory);
		loginFormMapper = super.getMapper(LoginFormMapper.class);
	}
	
		
	@Override
	public int createLogin(LoginForm login) {
	
		 return loginFormMapper.createLogin(login);
	}

	
	@Override
	public LoginForm getByUsername(String username) {
			
		return loginFormMapper.getByUsername(username);
	}

	
}
